
kernal_version () {
  echo `uname -r`
}

is_64 () {
  [[ `getconf LONG_BIT` == '64' ]]
  #if [[ `getconf LONG_BIT` == '64' ]]; then
  #  return 0
  #fi
  #return 1
}

#######################################

#system_numerical_user_id_to_name () {
#  local GREP CUT RESULT
#  mbfl_mandatory_parameter(ID, 1, numerical user id)
#  GREP=$(mbfl_program_found grep) || exit $?
#  CUT=$(mbfl_program_found cut)   || exit $?
#  mbfl_program_exec ${GREP} "^[^:]\+:[^:]\+:${ID}:" /etc/passwd | \
#  mbfl_program_exec ${CUT} -d: -f1
#}
#
#system_user_name_to_numerical_id () {
#  local GREP CUT
#  mbfl_mandatory_parameter(NAME, 1, user name)
#  GREP=$(mbfl_program_found grep) || exit $?
#  CUT=$(mbfl_program_found cut)   || exit $?
#  mbfl_program_exec ${GREP} "^${NAME}" /etc/passwd | \
#  mbfl_program_exec ${CUT} -d: -f3
#}
#
#declare -a mbfl_symbolic_permissions
#mbfl_symbolic_permissions[0]='---'
#mbfl_symbolic_permissions[1]='--x'
#mbfl_symbolic_permissions[2]='-w-'
#mbfl_symbolic_permissions[3]='-wx'
#mbfl_symbolic_permissions[4]='r--'
#mbfl_symbolic_permissions[5]='r-x'
#mbfl_symbolic_permissions[6]='rw-'
#mbfl_symbolic_permissions[7]='rwx'
#
#mbfl_system_symbolic_to_octal_permissions ()
#{
#  mbfl_mandatory_parameter(MODE, 1, symbolic permissions)
#  for ((i=0; $i < 8; ++i))
#  do test "${mbfl_symbolic_permissions[$i]}" =
#    "${MODE}" &&
#    {
#      printf "${i}\n"
#      return 0
#    }
#  done
#  return
#  1
#}
#
#mbfl_system_octal_to_symbolic_permissions ()
#{
#  mbfl_mandatory_parameter(MODE,
#  1,
#  symbolic
#  permissions)
#  printf
#  "${mbfl_symbolic_permissions[${MODE}]}\n"
#}
#
#is_run_fg {
#    #check script run in the foreground or background.
#
#    if [[  -t 0 ]];then
#        echo 1
#    else
#        echo 0
#    fi
#}
#
#
#get_pid() {
#    local pid_file=$1
#    local pid_n='null'
#    [ -f $pid_file ] && let pid_n=`cat $pid_file`
#    echo $pid_n
#}
#
#
#set_pid() {
#    local pid_file=$1
#    echo $$ > ${pid_file}
#    echo $$
#}
#
#
#unset_pid() {
#    local pid_file=$1
#    [[ -f $pid_file ]] && rm -f $pid_file
#}
#
#
#is_proc_active() {
#    local pid_num=$1
#    local proc_state=0
#    if [ "${pid_num}" != 'null' ];then
#        if [ ${pid_num} -gt 0 -a -d /proc/${pid_num} ];then
#            proc_state=1
#        else
#            proc_state=0
#
#        fi
#    else
#        proc_state=0
#    fi
#    echo $proc_state
#
#}
#
#
#kill_proces() {
#    local all_procs=`ps -Af|grep -v 'grep'|grep $1|awk '{print $2}'`
#    local proc
#    for proc in ${all_procs[@]}
#    do
#        [[ $$ -eq $proc ]] && continue
#        echo "kill proc [${proc}] .. "
#        kill -n TERM ${proc}
#    done
#}
#
#
#kill_signal_proc() {
#    local pid_file=$1
#    local s_pid
#    s_pid=$(get_pid "$pid_file")
#    if [[ $(is_proc_active $s_pid) -eq 1 ]];then
#          kill -n TERM $s_pid
#    fi
#}
#
#
#wait_p() {
#    local t_secs=${1-3}
#    local p_str=${2-'.'}
#    echo -n "Wait for ${t_secs} seconds ";
#    for (( i=0; i<t_secs; i++ ))
#    do
#        echo -n "${p_str}";sleep 1
#    done
#    echo
#}
#
#
#worker_manager() {
#    local job_num=${1-1}
#    local worker_func=$2
#    for (( i=0; i<job_num; i++ ))
#    do
#        (${worker_func} "${@:3}") &
#    done
#    wait
#}
#
#
#is_func() {
#    local func_name=$1
#    local r_type=$(type -t ${func_name} 2>/dev/null)
#    if [[ "${r_type}" == '' ]];then
#        echo 1
#    else
#        echo 0
#    fi
#
#}
#
#overtime_func() {
#    local curr_date=$(date)
#    local prog_id=$1
#    local prog_pid=$2
#    local overtime_action=${3:null}
#    echo "alert:${prog_id} is overtime !"
#    local m_content="${curr_date} > ${prog_id} is overtime !"
#    local m_sub="${curr_date} alert:${prog_id}"
#    send_m_email "$m_sub"  "$m_content"
#
#    case  "$overtime_action" in 
#       kill1)
#           kill_signal_proc "${prog_pid}"
#           ;;
#       kill2)
#           kill_signal_proc "${prog_pid}"
#           kill_proces "${prog_id}"
#           ;;
#       null|*)
#       ;;
#    esac
#}

